Skip to content

fix(function): align JSON operator string comparison with MySQL semantics#24018

Merged
mergify[bot] merged 7 commits intomainfrom
copilot/fix-wrong-result-with-json-operator
Apr 27, 2026
Merged

fix(function): align JSON operator string comparison with MySQL semantics#24018
mergify[bot] merged 7 commits intomainfrom
copilot/fix-wrong-result-with-json-operator

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 30, 2026

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #23935

What this PR does / why we need it:

The -> JSON extract operator followed by comparison (>, <, >=, <=) was silently casting JSON to VARCHAR and performing string comparison, which deviates from MySQL behavior. MySQL returns an error for JSON-to-string ordering comparisons.

Changes:

  • Added jsonOrderingWithStringNotSupported helper in func_compare.go and applied it in list_operator.go to restore the JSON+string ordering error for >, <, >=, <= and BETWEEN.
  • Fixed = comparison on JSON-extracted strings to use unquoted values ('CODE-3' instead of '"CODE-3"'), matching MySQL semantics.
  • Propagated MarshalJSON errors in jsonToStr instead of silently ignoring them.
  • Updated test expectations in func_json_extract.test, func_like.test, and row_constructor.sql to reflect the corrected behavior.

Copilot AI linked an issue Mar 30, 2026 that may be closed by this pull request
1 task
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 30, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ aptend
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI changed the title [WIP] Fix wrong result with '->' operator in SQL query Fix JSON -> operator string comparison to match MySQL semantics Mar 30, 2026
Copilot AI requested a review from aptend March 30, 2026 06:31
@matrix-meow matrix-meow added the size/S Denotes a PR that changes [10,99] lines label Mar 30, 2026
@aptend aptend changed the title Fix JSON -> operator string comparison to match MySQL semantics fix(function): align JSON operator string comparison with MySQL semantics Apr 27, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 27, 2026

Merge Queue Status

  • Entered queue2026-04-27 11:29 UTC · Rule: main
  • Checks skipped · PR is already up-to-date
  • Merged2026-04-27 11:29 UTC · at d46b78b29f90b9e274f2a37c4f4f9d82ec6f2b09 · squash

This pull request spent 25 seconds in the queue, including 3 seconds running CI.

Required conditions to merge
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • branch-protection-review-decision = APPROVED [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-neutral = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-skipped = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Ubuntu/x86
    • check-neutral = Matrixone CI / SCA Test on Ubuntu/x86
    • check-skipped = Matrixone CI / SCA Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-neutral = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-skipped = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
  • any of [🛡 GitHub branch protection]:
    • check-skipped = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: wrong result with '->'

8 participants